module ApplicationHelper
  def load_sold_template(f, association)
    new_object = f.object.class.reflect_on_association(association).klass.new
    fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
      render(association.to_s + "/form", :f => builder)
    end
    javascript_tag("var content = \"#{escape_javascript(fields)}\"")
  end
end
